Description: upstream: 64269 64270
Index: virtualbox/src/VBox/Additions/common/crOpenGL/Makefile.kmk
===================================================================
--- virtualbox.orig/src/VBox/Additions/common/crOpenGL/Makefile.kmk
+++ virtualbox/src/VBox/Additions/common/crOpenGL/Makefile.kmk
@@ -71,7 +71,7 @@
 	/usr/include/x11 \
 	/usr/include/xorg \
 	/usr/include/pixman-1 \
-	$(VBOX_MESA_INCS) \
+	$(VBOX_GL_INCS) \
 	/usr/include/drm \
 	/usr/include/libdrm
  VBoxOGL_DEFS     += VBOX_NO_NATIVEGL
@@ -439,7 +439,7 @@
 	array
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGLarrayspu_INCS += \
-        $(VBOX_MESA_INCS)
+        $(VBOX_GL_INCS)
 endif
 if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_WDDM)
  VBoxOGLarrayspu_INSTTYPE.win = none
@@ -487,7 +487,7 @@
 	passthrough
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGLpassthroughspu_INCS += \
-        $(VBOX_MESA_INCS)
+        $(VBOX_GL_INCS)
 endif
 if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_WDDM)
  VBoxOGLpassthroughspu_INSTTYPE.win = none
@@ -536,7 +536,7 @@
 	pack
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGLpackspu_INCS += \
-        $(VBOX_MESA_INCS)
+        $(VBOX_GL_INCS)
 endif
 if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_WDDM)
  VBoxOGLpackspu_INSTTYPE.win = none
@@ -642,7 +642,7 @@
 	feedback
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGLfeedbackspu_INCS += \
-        $(VBOX_MESA_INCS)
+        $(VBOX_GL_INCS)
 endif
 if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_WDDM)
  VBoxOGLfeedbackspu_INSTTYPE.win = none
Index: virtualbox/src/VBox/Additions/x11/Makefile.kmk
===================================================================
--- virtualbox.orig/src/VBox/Additions/x11/Makefile.kmk
+++ virtualbox/src/VBox/Additions/x11/Makefile.kmk
@@ -20,12 +20,18 @@
 # Include sub-makefiles.
 if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
  include $(PATH_SUB_CURRENT)/VBoxClient/Makefile.kmk
- include $(PATH_SUB_CURRENT)/vboxvideo/Makefile.kmk
- ifneq ($(KBUILD_TARGET), solaris)
-  include $(PATH_SUB_CURRENT)/vboxmouse/Makefile.kmk
- endif
- ifndef VBOX_USE_SYSTEM_XORG_HEADERS
-  include $(PATH_SUB_CURRENT)/x11stubs/Makefile.kmk
+ ifndef VBOX_NO_LEGACY_XORG_X11
+  include $(PATH_SUB_CURRENT)/vboxvideo/Makefile.kmk
+  ifneq ($(KBUILD_TARGET), solaris)
+   include $(PATH_SUB_CURRENT)/vboxmouse/Makefile.kmk
+  endif
+  # This should logically only be controlled by VBOX_NO_LEGACY_XORG_X11,
+  # as it is not used for drivers at all, but rather to build X11 clients
+  # on systems missing needed libraries.
+  ## @todo fix at some later point when it will not break people's workflows.
+  ifndef VBOX_USE_SYSTEM_XORG_HEADERS
+   include $(PATH_SUB_CURRENT)/x11stubs/Makefile.kmk
+  endif
  endif
 endif
 
Index: virtualbox/src/VBox/GuestHost/OpenGL/Makefile.kmk
===================================================================
--- virtualbox.orig/src/VBox/GuestHost/OpenGL/Makefile.kmk
+++ virtualbox/src/VBox/GuestHost/OpenGL/Makefile.kmk
@@ -54,7 +54,7 @@
 VBoxOGLcrutil_INTERMEDIATES = $(VBOX_PATH_CROGL_GENFILES)/cr_opcodes.h
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGLcrutil_INCS += \
-	$(VBOX_MESA_INCS)
+	$(VBOX_GL_INCS)
 endif
 VBoxOGLcrutil_SOURCES       = \
 	util/bbox.c \
@@ -199,7 +199,7 @@
 	packer
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGLcrpacker_INCS += \
-	$(VBOX_MESA_INCS)
+	$(VBOX_GL_INCS)
 endif
 VBoxOGLcrpacker_INTERMEDIATES = \
 	$(VBOX_PATH_CROGL_GENFILES)/cr_packfunctions.h \
@@ -350,7 +350,7 @@
 	$(VBOX_PATH_CROGL_GENFILES)/spu_dispatch_table.h
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGLspuload_INCS += \
-	$(VBOX_MESA_INCS)
+	$(VBOX_GL_INCS)
 endif
 VBoxOGLspuload_SOURCES = \
 	spu_loader/spuinit.c \
@@ -423,7 +423,7 @@
 	state_tracker
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGLcrstate_INCS += \
-	$(VBOX_MESA_INCS)
+	$(VBOX_GL_INCS)
 endif
 VBoxOGLcrstate_INTERMEDIATES = \
 	$(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h \
@@ -624,7 +624,7 @@
 	$(VBOX_PATH_CROGL_GENFILES)/spu_dispatch_table.h
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGLerrorspu_INCS += \
-	$(VBOX_MESA_INCS)
+	$(VBOX_GL_INCS)
 endif
 VBoxOGLerrorspu_SOURCES = \
 	$(VBOX_PATH_CROGL_GENFILES)/errorspu.c \
Index: virtualbox/src/VBox/Additions/x11/vboxvideo/helpers.c
===================================================================
--- virtualbox.orig/src/VBox/Additions/x11/vboxvideo/helpers.c
+++ virtualbox/src/VBox/Additions/x11/vboxvideo/helpers.c
@@ -82,7 +82,7 @@
 
     property_name = MakeAtom(pszName, strlen(pszName), TRUE);
     VBVXASSERT(property_name != BAD_RESOURCE, ("Failed to set atom \"%s\"\n", pszName));
-    ChangeWindowProperty(ROOT_WINDOW(pScrn), property_name, XA_INTEGER, 32, PropModeReplace, cData, paData, fSendEvent);
+    dixChangeWindowProperty(serverClient, ROOT_WINDOW(pScrn), property_name, XA_INTEGER, 32, PropModeReplace, cData, paData, fSendEvent);
 }
 
 void vbvxReprobeCursor(ScrnInfoPtr pScrn)
Index: virtualbox/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
===================================================================
--- virtualbox.orig/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
+++ virtualbox/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
@@ -1229,7 +1229,7 @@
     updateGraphicsCapability(pScrn, TRUE);
 
     /* Register block and wake-up handlers for getting new screen size hints. */
-    RegisterBlockAndWakeupHandlers(vboxBlockHandler, (WakeupHandlerProcPtr)NoopDDA, (pointer)pScrn);
+    RegisterBlockAndWakeupHandlers(vboxBlockHandler, (ServerWakeupHandlerProcPtr)NoopDDA, (pointer)pScrn);
 
     /* software cursor */
     miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
--- virtualbox-5.1.10-dfsg.orig/src/VBox/Additions/x11/vboxvideo/Makefile.kmk
+++ virtualbox-5.1.10-dfsg/src/VBox/Additions/x11/vboxvideo/Makefile.kmk
@@ -376,7 +376,7 @@ vboxvideo_drv_118_SOURCES := $(vboxvideo
 
 ifdef VBOX_USE_SYSTEM_XORG_HEADERS
  # Build using local X.Org headers.  We assume X.Org Server 1.7 or later.
- DLLS    := $(filter-out vboxvideo_drv_%,$(DLLS)) vboxvideo_drv_system
+ DLLS    := $(filter-out vboxvideo_drv_%,$(DLLS))
  SYSMODS := $(filter-out vboxvideo_drv%,$(SYSMODS))
  vboxvideo_drv_system_TEMPLATE = VBOXGUESTR3XORGMOD
  vboxvideo_drv_system_CFLAGS := \
